﻿
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: DictionaryBLL.gen.cs
//
// 模块名称: DictionaryBll
//
// 作者: LPC
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 13-1-29    LPC    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Data;
using Common;
using DAL;
using Model;
using System.Data.SqlClient;

namespace BLL
{
    /// <summary>
    /// Dictionary表业务逻辑层
    /// </summary>
    public class DictionaryBLL : BaseBLL
    {
        public DictionaryBLL(LoginInfo info)
        {
            loginInfo = info;
        }
        private const string ErrorCodeSelect = ""; //查询异常编码
        private const string ErrorCodeInsert = ""; //添加异常编码
        private const string ErrorCodeUpdate = ""; //修改异常编码
        private const string ErrorCodeDelete = ""; //删除异常编码

        public DictionaryInfo GetInfoById(string guid)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetInfoById(guid);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "GetInfo", AppError.EROR, 0, ex, "获取DictionaryBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }
        public List<SysConfig> GetSysConfig(string type)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetSysConfig(type);
            }
            catch (Exception ex)
            {
                ;
                throw ex;
            }
        }
        public List<UserIFConfig> GetUserIFConfig()
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetUserIFConfig();
            }
            catch (Exception ex)
            {
                ;
                throw ex;
            }
        }
        public List<SQLObjects> GetObjects(string s, string t, string c)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetObjects(s, t, c);
            }
            catch (Exception ex)
            {
                ;
                throw ex;
            }
        }
        public List<EtlSourceSystemInfo> GetSourceList()
        {

            DictionaryDAL dal = new DictionaryDAL(loginInfo);
            return dal.GetSourceList();
        }
        public List<EtlTargetSystemInfo> GetTargetList()
        {

            DictionaryDAL dal = new DictionaryDAL(loginInfo);
            return dal.GetTargetList();
        }
        public DataTable RunSQL(string s)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.RunSQL(s);
            }
            catch (Exception ex)
            {
                ;
                throw ex;
            }
        }
        public DataTable RunSQL(string s, string tp, string cs)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.RunSQL(s, tp, cs);
            }
            catch (Exception ex)
            {
                ;
                throw ex;
            }
        }
        public List<ETL_DBDriverConfig> GetDBDriverConfig()
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetDBDriverConfig();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int UpdateDBDriverConfig(SqlParameter[] para)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.UpdateDBDriverConfig(para);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public DictionaryInfo GetDictById(string guid)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetDictById(guid);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "GetInfo", AppError.EROR, 0, ex, "获取DictionaryBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 往Dictionary表内添加新记录
        /// </summary>
        /// <param> <name>dictionaryInfo</name> </param>
        /// <param name="dictionaryInfo"> </param>
        /// <returns>添加记录索引值</returns>
        public int Insert(IDataParameter[] dictionaryInfo)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                int identity = dal.Insert(dictionaryInfo);
                return identity;
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        /// <summary>
        /// 更新Dictionary表记录
        /// </summary>
        /// <param name="dictionaryInfo"> </param>
        public int Update(SqlParameter[] pare)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.Update(pare);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        /// <summary>
        /// 往Dictionary表内添加新记录
        /// </summary>
        /// <param> <name>dictionaryInfo</name> </param>
        /// <param name="dictionaryInfo"> </param>
        /// <returns>添加记录索引值</returns>
        public int InsertMT(IDataParameter[] dictionaryInfo)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                int identity = dal.InsertMT(dictionaryInfo);
                return identity;
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "Insert", AppError.EROR, 0, ex, "添加DictionaryBll信息出错。", null);
                throw new SystemException(ErrorCodeInsert, ex);
            }
        }

        /// <summary>
        /// 更新Dictionary表记录
        /// </summary>
        /// <param name="dictionaryInfo"> </param>
        public int UpdateMT(SqlParameter[] pare)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.UpdateMT(pare);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "Update", AppError.EROR, 0, ex, "更新DictionaryBll信息出错。", "");

                throw new SystemException(ErrorCodeUpdate, ex);
            }
        }
        /// <summary>
        /// 根据GUID字段获取DictionaryInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        public int Delete(string guid)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.Delete(guid);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "Delete", AppError.EROR, 0, ex, "删除DictionaryBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeDelete, ex);
            }
        }
        public int SaveSysConfig(string TimeOut, string TimeOutLot)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.SaveSysConfig(TimeOut, TimeOutLot);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int SaveSysConfig(string IFName)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.SaveSysConfig(IFName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// 根据GUID字段获取DictionaryInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        public int DeleteMT(string guid)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.DeleteMT(guid);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "Delete", AppError.EROR, 0, ex, "删除DictionaryBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeDelete, ex);
            }
        }
        /// <summary>
        /// 根据GUID字段获取DictionaryInfo实体对象
        /// </summary>
        /// <param name="dictionaryInfo"> </param>
        /// <returns>List<DictionaryInfo/>实体对象</returns>
        public List<DictionaryInfo> GetList(IDataParameter[] dictionaryInfo, string s, string o)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetList(dictionaryInfo, s, o);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List<DictionaryInfo> GetParentList(IDataParameter[] dictionaryInfo)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetParentList(dictionaryInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// 根据GUID字段获取DictionaryInfo实体对象
        /// </summary>
        /// <param name="dictionaryInfo"> </param>
        /// <returns>List<DictionaryInfo/>实体对象</returns>
        public List<DictionaryInfo> GetMTList(IDataParameter[] dictionaryInfo)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetMTList(dictionaryInfo);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "GetInfo", AppError.EROR, 0, ex, "获取DictionaryBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }
        public List<DictionaryInfo> GetListByFeathId(string featherId)
        {
            try
            {
                DictionaryDAL dal = new DictionaryDAL(loginInfo);
                return dal.GetListByFeathId(featherId);
            }
            catch (Exception ex)
            {
                Logger.LogError("DictionaryBLL", "GetInfo", AppError.EROR, 0, ex, "获取DictionaryBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        public IList<DictionaryInfo> GetListByKeyName(string keyName)
        {
            DictionaryDAL dal = new DictionaryDAL(loginInfo);
            return dal.GetListByKeyName(keyName);
        }

        public IList<DictionaryInfo> GetMTListByKeyName(string keyName)
        {
            DictionaryDAL dal = new DictionaryDAL(loginInfo);
            return dal.GetMTListByKeyName(keyName);
        }
        public string GetNameByKeyNameAndValue(string keyName, string value)
        {
            DictionaryDAL dal = new DictionaryDAL(loginInfo);
            return dal.GetNameByKeyNameAndValue(keyName, value);
        }
    }

}
